C (244/254)

From:Alastair M. Robinson
Date:02 Apr 00 at 00:36:46
Subject:WBStartup messages

Hi Bart,

> One of the largest problems I'm having is the lack of any Workbench
> support in VBCC's startup code (or at least I couldn't see any).

If you're linking with the standard startup.o (i.e. not minstart.o), the
startup code gets the workbench startup message for you, and stores
it in a global variable called WBenchMsg. As you say, there's no separate
wbmain() entry, so instead you have to check WBenchMsg in main().

> Because my project ideally should be run from Workbench, it uses
> tooltypes to get options. However, I can't figure out how to even get
> the WBStartup message to open the icon. SAS/C uses argc and argv, Storm
> uses wbmain()...

Your best bet is to do something like this:

extern struct WBStartup *WBenchMsg;

int main()
{
if(WBenchMsg) /* This will be NULL if we started from shell */
{
/* Get icon and do ToolTypes stuff */
}
else
{
/* use ReadArgs (or use GetProgramName()/Dir() to fetch the icon,
and use ToolTypes again.) */
}
return(0);
}

All the best,



Alastair M. Robinson, email:blackfive@fakenhamweb.co.uk
Amiga 4000/030, 18Meg RAM, 4.3Gig HD, Mustek ScanExpress 6000SP
C, Assembler (68k, PIC16C84, ATMEL AVR), PostScript,
ARexx, AMOSPro(!), AmigaDOS

Hehehehe, 2400 baud sucks! V.bis and Baudhead.

------------------------------------------------------------------------
PERFORM CPR ON YOUR APR!
Get a NextCard Visa, in 30 seconds! Get rates as low as
0.0% Intro or 9.9% Fixed APR and no hidden fees.
Apply NOW!
http://click.egroups.com/1/2121/1/_/451227/_/954630454/
------------------------------------------------------------------------